<template>
  <div>{{ props.params1 }}</div>
  <el-button @click="handleUpdate(1)">update params1</el-button>
  <div>{{ props.params2 }}</div>
  <el-button @click="handleUpdate(2)">update params2</el-button>
  <div>{{ dataObj.name }}</div>
  <el-button @click="handleUpdate(3)">update params3</el-button>
</template>

<script setup>
const props = defineProps({
  params1: String,
  params2: String,
  dataObj: Object
})

const emit = defineEmits(['update:params1', 'update:params2', 'finish'])

const handleUpdate = (type) => {
  if (type === 1) {
    emit('update:params1', '子组件1改变数据')
  } else if (type === 2) {
    emit('update:params2', '子组件2改变数据')
  } else {
    emit('finish', { name: '123' })
  }
}
</script>

<style lang="scss" scoped></style>